﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
namespace GameTank
{
    public class HumanController : CharacterController
    {
        public HumanController(Character ch)
        {
            Parent = ch;
        }
        public override void UpDatePosition(GameTime gameTime)
        {
            MyGamePad gamePad = Game1.gamepad;
            if (gamePad.Up.IsDown)
            {
                this.Parent.MoveUp();
            }
            else
            if (gamePad.Left.IsDown)
            {
                this.Parent.MoveLeft();
            }
            else
            if (gamePad.Right.IsDown)
            {
                this.Parent.MoveRight();
            }
            else
            if (gamePad.Down.IsDown)
            {
                this.Parent.MoveDown();
            }

            if (!gamePad.Up.IsDown && !gamePad.Down.IsDown && !gamePad.Right.IsDown && !gamePad.Left.IsDown)
            {
                Parent.stopMove();
            }
        }

        public override void UpDateFire(GameTime gameTime)
        {
            MyGamePad gamePad = Game1.gamepad;
            if (gamePad.A.IsDown)
            {
                Parent.fire();
            }
        }
    }
}
